/******************************************************************************
 * @File name   :      PackageInventoryDaoImpl.java
 *
 * @Author      :      JIZHANGS
 *
 * @Date        :      Jul 23, 2015
 *
 * @Copyright Notice: 
 * Copyright (c) 2015 Capgemini, Inc. All  Rights Reserved.
 * This software is published under the terms of the Capgemini Software
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 * 
 * 
 * ----------------------------------------------------------------------------
 * Date                   Who         Version        Comments
 * Jul 23, 2015 4:18:28 PM        JIZHANGS     1.0            Initial Version
 *****************************************************************************/
package com.cap.bts.crmdp.dealer.remind.dao.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import com.cap.bts.crmdp.dealer.remind.dao.IRemindQuotaDao;
import com.cap.bts.crmdp.dealer.remind.domain.RemindQuota;
import com.cap.bts.framework.common.dao.impl.BaseDaoImpl;
import com.cap.bts.framework.common.exception.AppException;

/**
 *
 */
@Repository("remindQuotaDao")
public class RemindQuotaDaoImpl extends BaseDaoImpl<RemindQuota, Long> implements IRemindQuotaDao {
    /**
     * @Date        :      Jul 23, 2015
     * @param clazz
     */
    @Inject
    public RemindQuotaDaoImpl(@Value("com.cap.bts.crmdp.dealer.remind.domain.RemindQuota")  Class<RemindQuota> clazz) {
        super(clazz);
    }

    /**
     * {@inheritDoc} 
     * overridden:
     * @Date        :      Dec 2, 2015
     * @see com.cap.bts.crmdp.dealer.remind.dao.IRemindQuotaDao#getRemindQuotaByDealerId(java.lang.Long)
    **/
    @Override
    public RemindQuota getRemindQuotaByDealerId(Long dealerId) throws AppException {
      List<RemindQuota> list=super.getListByQuery("from RemindQuota a where a.dealerId='"+dealerId+"'");
      RemindQuota remindQuota=null;
      if(list!=null&&!list.isEmpty()) {
          remindQuota=list.get(0);
      }
      return remindQuota;
    }


  
}
